package com.github.xuemingyu.springboot.jkfaststart.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.persistence.EntityManager;


@Configuration
public class JPAQueryFactoryConfig {

    //实体管理者
    @Autowired
    private EntityManager entityManager;


    @Bean(name = "jpaQueryFactory")
    public JPAQueryFactory GetJPAQueryFactory(){
        System.out.println("init JPAQueryFactory successfully");
        return new JPAQueryFactory(entityManager);
    }

}
